from libs.common import success
from libs.db import DB


def check(request):
    db = DB('table_update_manage')
    row = db.order_by('id desc').one(['id', 'big_version', 'remark', 'times'], {'type': 2})
    resp = {
        'isForce': False,
        'msg': '',
        'version': '',
        'time': ''
    }
    if row.get('id', 0) > 0:
        resp = {
            'isForce': True,
            'msg': row.get('remark', ''),
            'version': row.get('big_version', ''),
            'times': row.get('times', ''),
        }
    return success(resp)
